package repository;


import com.uber.autodispose.FlowableSubscribeProxy;
import com.xgggh.redpack.BuildConfig;
import com.xgggh.redpack.domain.auth.Auth;
import com.xgggh.redpack.domain.redpack.Pack;
import java.util.List;
import javax.inject.Inject;

import io.reactivex.Flowable;
import io.reactivex.subscribers.DisposableSubscriber;
import model.Rsp;
import model.Status;
import retrofit2.Retrofit;
import retrofit2.mock.MockRetrofit;
import service.RedPackService;


public class RedPackRepository extends BaseRepository{

    Retrofit retrofit;
    MockRetrofit mockRetrofit;

    @Inject
    public RedPackRepository(Retrofit retrofit, MockRetrofit mockRetrofit) {
        this.retrofit = retrofit;
        this.mockRetrofit = mockRetrofit;
    }

    public Flowable<Rsp<List<Pack>>> getRedPackList(int page,int size,Pack pack) {
        return retrofit.create(RedPackService.class)
                .getSearchList(page,size,"id",pack)
                .compose(ioTransformer());
    }

    public Flowable<Rsp<Pack>> createRedPack(Pack pack) {
        return retrofit.create(RedPackService.class)
                .create(pack)
                .compose(ioTransformer())
                ;
    }
}
